﻿using System;
using System.Reflection;
using NUnit.Framework;

namespace Dgg.LearnYourTools.NUnit.B_DataTesting.a_TestCase
{
	[TestFixture]
	public class _007_HandlingExceptions
	{
		[TestCase(4, 2, Result = 2)]
		[TestCase(4, 0, ExpectedException = typeof(DivideByZeroException))]
		public int TestCase_CanHandleExceptions(int i, int j)
		{
			return i / j;
		}

		[TestCase(42, ExpectedException = typeof(AmbiguousMatchException), ExpectedMessage = "42", MatchType = MessageMatch.Contains)]
		public void TestCase_CanHanledExceptionMessages(int i)
		{
			throw new AmbiguousMatchException("Message contains " + i);
		}
	}
}
